package com.lims.landInfo.dao;

import org.springframework.stereotype.Repository;

import javacommon.base.*;

import cn.org.rapid_framework.page.*;

import com.lims.landInfo.model.*;
import com.lims.landInfo.vo.query.*;

/**
 * @author zzh
 * @version 1.0
 * @since 1.0
 */@Repository @SuppressWarnings("unchecked")
public class BookDao extends BaseHibernateDao<Book,java.lang.String>{
	
	public Class getEntityClass() {
		return Book.class;
	}
	
	public Page findPage(BookQuery query) {
        //XsqlBuilder syntax,please see http://code.google.com/p/rapid-xsqlbuilder
        // [column]为字符串拼接, {column}为使用占位符. [column]为使用字符串拼接,如username='[username]',偷懒时可以使用字符串拼接 
        // [column] 为PageRequest的属性
		String sql = "select t from Book t where 1=1 "
			  	+ "/~ and t.sno = {sno} ~/"
			  	+ "/~ and t.landno = {landno} ~/"
			  	+ "/~ and t.originalAmount = {originalAmount} ~/"
			  	+ "/~ and t.intangibleAmount = {intangibleAmount} ~/"
			  	+ "/~ and t.fixedAmount = {fixedAmount} ~/"
			  	+ "/~ and t.processAmount = {processAmount} ~/"
			  	+ "/~ and t.otherAmount = {otherAmount} ~/"
			  	+ "/~ and t.netWorth = {netWorth} ~/"
			  	+ "/~ and t.isPurchase = {isPurchase} ~/"
			  	+ "/~ and t.purchaseAmount = {purchaseAmount} ~/"
			  	+ "/~ and t.changeType = {changeType} ~/"
			  	+ "/~ and t.oldno = {oldno} ~/"
			  	+ "/~ and t.oldContent = {oldContent} ~/"
			  	+ "/~ and t.describe = {describe} ~/"
				+ "/~ and t.landDate >= {landDateBegin} ~/"
				+ "/~ and t.landDate <= {landDateEnd} ~/"
				+ "/~ and t.createDate >= {createDateBegin} ~/"
				+ "/~ and t.createDate <= {createDateEnd} ~/"
				+ " order by t.sno asc ";
        
		return pageQuery(sql,query);
	}
	

}
